package presentation;

import java.rmi.RemoteException;

import integration.UserDAORemote;

import javax.naming.*;
import javax.servlet.http.HttpSession;

import metier.UserBean;

public class Quitter implements Runnable {
	
	HttpSession session;

	public void setSession(HttpSession session) {
		this.session = session;
	}

	public void run(){
		HttpSession test;
		UserBean ub = (UserBean)session.getAttribute("ub");

		InitialContext context;
		try {
			context = new InitialContext();
			//dans renvoi UserDAOImpl
			UserDAORemote uDAO = (UserDAORemote) context.lookup("dao/UserDAO");
			uDAO.insert(ub);
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		

		

	}
}
